home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / menu.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  22.3 KB  |  644 lines

  1. '\"
  2. '\" Copyright 1990 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/menu.man,v 1.10 92/06/03 17:07:11 ouster Exp $ SPRITE (Berkeley)
  11. '/" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS menu cmds
  189. .BS
  190. '\" Note:  do not modify the .SH NAME line immediately below!
  191. .SH NAME
  192. menu \- Create and manipulate menu widgets
  193. .SH SYNOPSIS
  194. \fBmenu\fI \fIpathName \fR?\fIoptions\fR?
  195. .SH "STANDARD OPTIONS"
  196. .LP
  197. .nf
  198. .ta 4c 8c 12c
  199. .VS
  200. \fBactiveBackground\fR    \fBbackground\fR    \fBdisabledForeground\fR
  201. \fBactiveBorderWidth\fR    \fBborderWidth\fR    \fBfont\fR
  202. \fBactiveForeground\fR    \fBcursor\fR    \fBforeground\fR
  203. .VE
  204. .fi
  205. .LP
  206. See the ``options'' manual entry for details on the standard options.
  207. .SH "WIDGET-SPECIFIC OPTIONS"
  208. .ta 4c
  209. .LP
  210. .nf
  211. Name:    \fBselector\fR
  212. Class:    \fBForeground\fR
  213. Command-Line Switch:    \fB\-selector\fR
  214. .fi
  215. .IP
  216. For menu entries that are check buttons or radio buttons, this option
  217. specifies the color to display in the selector when the check button
  218. or radio button is selected.
  219. .BE
  220.  
  221. .SH INTRODUCTION
  222. .PP
  223. The \fBmenu\fR command creates a new top-level window (given
  224. by the \fIpathName\fR argument) and makes it into a menu widget.
  225. Additional
  226. options, described above, may be specified on the command line
  227. or in the option database
  228. to configure aspects of the menu such as its colors and font.
  229. The \fBmenu\fR command returns its
  230. \fIpathName\fR argument.  At the time this command is invoked,
  231. there must not exist a window named \fIpathName\fR, but
  232. \fIpathName\fR's parent must exist.
  233. .PP
  234. A menu is a widget that displays a collection of one-line entries arranged
  235. in a column.  There exist several different types of entries,
  236. each with different properties.  Entries of different types may be
  237. combined in a single menu.  Menu entries are not the same as
  238. entry widgets.  In fact, menu entries are not even distinct widgets;
  239. the entire menu is one widget.
  240. .PP
  241. Menu entries are displayed with up to three
  242. separate fields.  The main field is a label in the form of text or
  243. a bitmap, which is determined by the \fB\-label\fR or \fB\-bitmap\fR
  244. option for the entry.
  245. If the  \fB\-accelerator\fR option is specified for an entry then a second
  246. textual field is displayed to the right of the label.  The accelerator
  247. typically describes a keystroke sequence that may be typed in the
  248. application to cause the same result as invoking the menu entry.
  249. The third field is a \fIselector\fR.  The selector is present only for
  250. check-button or radio-button entries.  It indicates whether the entry
  251. is selected or not, and is displayed to the left of the entry's
  252. string.
  253. .PP
  254. In normal use, an entry becomes active (displays itself differently)
  255. whenever the mouse pointer is over the entry.  If a mouse
  256. button is released over the entry then the entry is \fIinvoked\fR.
  257. The effect of invocation is different for each type of entry;
  258. these effects are described below in the sections on individual
  259. entries.
  260. .PP
  261. Entries may be \fIdisabled\fR, which causes their labels
  262. and accelerators to be displayed
  263. with dimmer colors.  A disabled entry cannot be activated or invoked.
  264. Disabled entries may be re-enabled, at which point it becomes
  265. possible to activate and invoke them again.
  266.  
  267. .SH "COMMAND ENTRIES"
  268. .PP
  269. The most common kind of menu entry is a command entry, which
  270. behaves much like a button widget.  When a command entry is
  271. invoked, a Tcl command is executed.  The Tcl
  272. command is specified with the \fB\-command\fR option.
  273.  
  274. .SH "SEPARATOR ENTRIES"
  275. .PP
  276. A separator is an entry that is displayed as a horizontal dividing
  277. line.  A separator may not be activated or invoked, and it has
  278. no behavior other than its display appearance.
  279.  
  280. .SH "CHECK-BUTTON ENTRIES"
  281. .PP
  282. A check-button menu entry behaves much like a check-button widget.
  283. When it is invoked it toggles back and forth between the selected
  284. and deselected states.  When the entry is selected, a particular
  285. value is stored in a particular global variable (as determined by
  286. the \fB\-onvalue\fR and \fB\-variable\fR options for the entry);  when
  287. the entry is deselected another value (determined by the
  288. \fB\-offvalue\fR option) is stored in the global variable.
  289. A selector box is displayed to the left of the label in a check-button
  290. entry.  If the entry is selected then the box's center is displayed
  291. in the color given by the \fBselector\fR option for the menu;
  292. otherwise the box's center is displayed in the background color for
  293. the menu.  If a \fB\-command\fR option is specified for a check-button
  294. entry, then its value is evaluated as a Tcl command each time the entry
  295. is invoked;  this happens after toggling the entry's
  296. selected state.
  297.  
  298. .SH "RADIO-BUTTON ENTRIES"
  299. .PP
  300. A radio-button menu entry behaves much like a radio-button widget.
  301. Radio-button entries are organized in groups of which only one
  302. entry may be selected at a time.  Whenever a particular entry
  303. becomes selected it stores a particular value into a particular
  304. global variable (as determined by the \fB\-value\fR and
  305. \fB\-variable\fR options for the entry).  This action
  306. causes any previously-selected entry in the same group
  307. to deselect itself.
  308. Once an entry has become selected, any change to the entry's
  309. associated variable will cause the entry to deselect itself.
  310. Grouping of radio-button entries is determined by their
  311. associated variables:  if two entries have the same associated
  312. variable then they are in the same group.
  313. A selector diamond is displayed to the left of the label in each
  314. radio-button entry.  If the entry is selected then the diamond's
  315. center is displayed in the color given by the \fBselector\fR option
  316. for the menu;
  317. otherwise the diamond's center is displayed in the background color for
  318. the menu.  If a \fB\-command\fR option is specified for a radio-button
  319. entry, then its value is evaluated as a Tcl command each time the entry
  320. is invoked;  this happens after selecting the entry.
  321.  
  322. .SH "CASCADE ENTRIES"
  323. .PP
  324. A cascade entry is one with an associated menu (determined
  325. by the \fB\-menu\fR option.  Cascade entries allow the construction
  326. of cascading menus.  When the entry is activated, the
  327. associated menu is posted just to the right of the entry;
  328. that menu remains posted until the higher-level menu is unposted or
  329. until some other cascade entry is activated in the higher-level menu
  330. (each menu may have at most one posted cascade entry at a time).
  331. A cascade entry posts its associated menu by invoking a
  332. Tcl command of the form
  333. .RS
  334. .IP
  335. \fImenu\fB post \fIx y group\fR
  336. .RE
  337. .LP
  338. where \fImenu\fR is the path name of the associated menu, \fIx\fR
  339. and \fIy\fR are the root-window coordinates of the upper-right
  340. corner of the cascade entry, and \fIgroup\fR is the name of the
  341. menu's group (as determined in its last \fBpost\fR widget command).
  342. The lower-level menu is unposted by executing a Tcl command with
  343. the form
  344. .RS
  345. .IP
  346. \fImenu\fB unpost\fR
  347. .RE
  348. .LP
  349. where \fImenu\fR is the name of the associated menu.
  350. .LP
  351. If a \fB\-command\fR option is specified for a cascade
  352. entry, then its value is evaluated as a Tcl command each time the entry
  353. is invoked.
  354.  
  355. .SH "WIDGET COMMAND"
  356. .PP
  357. The \fBmenu\fR command creates a new Tcl command whose
  358. name is \fIpathName\fR.  This
  359. command may be used to invoke various
  360. operations on the widget.  It has the following general form:
  361. .DS C
  362. \fIpathName option \fR?\fIarg arg ...\fR?
  363. .DE
  364. \fIOption\fR and the \fIarg\fRs
  365. determine the exact behavior of the command.
  366. .PP
  367. Many of the widget commands for a menu take as one argument an
  368. indicator of which entry of the menu to operate on.  These
  369. indicators are called \fIindex\fRes and may be specified in
  370. any of the following forms:
  371. .TP 12
  372. \fInumber\fR
  373. Specifies the entry numerically, where 0 corresponds
  374. to the top-most entry of the menu, 1 to the entry below it, and
  375. so on.
  376. .TP 12
  377. \fBactive\fR
  378. Indicates the entry that is currently active.  If no entry is
  379. active then this form is equivalent to \fBnone\fR.  This form may
  380. not be abbreviated.
  381. .TP 12
  382. \fBlast\fR
  383. Indicates the bottommost entry in the menu.  If there are no
  384. entries in the menu then this form is equivalent to \fBnone\fR.
  385. This form may not be abbreviated.
  386. .TP 12
  387. \fBnone\fR
  388. Indicates ``no entry at all'';  this is used most commonly with
  389. the \fBactivate\fR option to deactivate all the entries in the
  390. menu.  In most cases the specification of \fBnone\fR causes
  391. nothing to happen in the widget command.
  392. This form may not be abbreviated.
  393. .TP 12
  394. \fB@\fInumber\fR
  395. In this form, \fInumber\fR is treated as a y-coordinate in the
  396. menu's window;  the entry spanning that y-coordinate is used.
  397. For example, ``\fB@0\fR'' indicates the top-most entry in the
  398. window.  If \fInumber\fR is outside the range of the window
  399. then this form is equivalent to \fBnone\fR.
  400. .TP 12
  401. \fIpattern\fR
  402. If the index doesn't satisfy one of the above forms then this
  403. form is used.  \fIPattern\fR is pattern-matched against the label of
  404. each entry in the menu, in order from the top down, until a
  405. matching entry is found.  The rules of \fBTcl_StringMatch\fR
  406. are used.
  407. .PP
  408. The following widget commands are possible for menu widgets:
  409. .TP
  410. \fIpathName \fBactivate \fIindex\fR
  411. Change the state of the entry indicated by \fIindex\fR to \fBactive\fR
  412. and redisplay it using its active colors.
  413. Any previously-active entry is deactivated.  If \fIindex\fR
  414. is specified as \fBnone\fR, or if the specified entry is
  415. disabled, then the menu ends up with no active entry.
  416. Returns an empty string.
  417. .TP
  418. \fIpathName \fBadd \fItype \fR?\fIoption value option value ...\fR?
  419. Add a new entry to the bottom of the menu.  The new entry's type
  420. is given by \fItype\fR and must be one of \fBcascade\fR,
  421. \fBcheckbutton\fR, \fBcommand\fR, \fBradiobutton\fR, or \fBseparator\fR,
  422. or a unique abbreviation of one of the above.  If additional arguments
  423. are present, they specify any of the following options:
  424. .RS
  425. .TP
  426. \fB\-activebackground \fIvalue\fR
  427. .VS
  428. Specifies a background color to use for displaying this entry when it
  429. is active.
  430. If this option is specified as an empty string (the default), then the
  431. \fBactiveBackground\fR option for the overall menu is used.
  432. This option is not available for separator entries.
  433. .VE
  434. .TP
  435. \fB\-accelerator \fIvalue\fR
  436. Specifies a string to display at the right side of the menu entry.
  437. Normally describes an accelerator keystroke sequence that may be
  438. typed to invoke the same function as the menu entry.  This option
  439. is not available for separator entries.
  440. .TP
  441. \fB\-background \fIvalue\fR
  442. .VS
  443. Specifies a background color to use for displaying this entry when it
  444. is in the normal state (neither active nor disabled).
  445. If this option is specified as an empty string (the default), then the
  446. \fBbackground\fR option for the overall menu is used.
  447. This option is not available for separator entries.
  448. .VE
  449. .TP
  450. \fB\-bitmap \fIvalue\fR
  451. Specifies a bitmap to display in the menu instead of a textual
  452. label, in any of the forms accepted by \fBTk_GetBitmap\fR.
  453. This option overrides the \fB\-label\fR option but may be reset
  454. to an empty string to enable a textual label to be displayed.
  455. This option is not available for separator entries.
  456. .TP
  457. \fB\-command \fIvalue\fR
  458. Specifies a Tcl command to execute when this menu entry is invoked.
  459. Not available for separator entries.
  460. .TP
  461. \fB\-font \fIvalue\fR
  462. .VS
  463. Specifies the font to use when drawing the label or accelerator
  464. string in this entry.
  465. If this option is specified as an empty string (the default) then
  466. the \fBfont\fR option for the overall menu is used.
  467. This option is not available for separator entries.
  468. .VE
  469. .TP
  470. \fB\-label \fIvalue\fR
  471. Specifies a string to display as an identifying label in the menu
  472. entry.  Not available for separator entries.
  473. .TP
  474. \fB\-menu \fIvalue\fR
  475. Available only for cascade entries.  Specifies the path name of
  476. the menu associated with this entry.
  477. .TP
  478. \fB\-offvalue \fIvalue\fR
  479. Available only for check-button entries.  Specifies the value to
  480. store in the entry's associated variable when the entry is
  481. deselected.
  482. .TP
  483. \fB\-onvalue \fIvalue\fR
  484. Available only for check-button entries.  Specifies the value to
  485. store in the entry's associated variable when the entry is selected.
  486. .TP
  487. \fB\-state \fIvalue\fR
  488. .VS
  489. Specifies one of three states for the entry:  \fBnormal\fR, \fBactive\fR,
  490. or \fBdisabled\fR.  In normal state the entry is displayed using the
  491. \fBforeground\fR option for the menu and the \fBbackground\fR
  492. option from the entry or the menu.
  493. The active state is typically used when the pointer is over the entry.
  494. In active state the entry is displayed using the \fBactiveForeground\fR
  495. option for the menu along with the \fBactivebackground\fR option from
  496. the entry.
  497. Disabled state means that the entry is insensitive:  it doesn't activate
  498. and doesn't respond to mouse button presses or releases.
  499. In this state the entry is displayed according to the 
  500. \fBdisabledForeground\fR option for the menu and the
  501. \fBbackground\fR option from the entry.
  502. This option is not available for separator entries.
  503. .TP
  504. \fB\-underline \fIvalue\fR
  505. Specifies the integer index of a character to underline in the entry.
  506. This option is typically used to indicate keyboard traversal characters.
  507. 0 corresponds to the first character of the text displayed in the entry,
  508. 1 to the next character, and so on.
  509. If a bitmap is displayed in the entry then this option is ignored.
  510. This option is not available for separator entries.
  511. .VE
  512. .TP
  513. \fB\-value \fIvalue\fR
  514. Available only for radio-button entries.  Specifies the value to
  515. store in the entry's associated variable when the entry is selected.
  516. .TP
  517. \fB\-variable \fIvalue\fR
  518. Available only for check-button and radio-button entries.  Specifies
  519. the name of a global value to set when the entry is selected.
  520. For check-button entries the variable is also set when the entry
  521. is deselected.  For radio-button entries, changing the variable
  522. causes the currently-selected entry to deselect itself.
  523. .LP
  524. The \fBadd\fR widget command returns an empty string.
  525. .RE
  526. .TP
  527. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  528. Query or modify the configuration options of the widget.
  529. If no \fIoption\fR is specified, returns a list describing all of
  530. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  531. information on the format of this list).  If \fIoption\fR is specified
  532. with no \fIvalue\fR, then the command returns a list describing the
  533. one named option (this list will be identical to the corresponding
  534. sublist of the value returned if no \fIoption\fR is specified).  If
  535. one or more \fIoption\-value\fR pairs are specified, then the command
  536. modifies the given widget option(s) to have the given value(s);  in
  537. this case the command returns an empty string.
  538. \fIOption\fR may have any of the values accepted by the \fBmenu\fR
  539. command.
  540. .TP
  541. \fIpathName \fBdelete \fIindex\fR
  542. Delete the menu entry indicated by \fIindex\fR.  Returns an empty string.
  543. .TP
  544. \fIpathName \fBdisable \fIindex\fR
  545. .VS
  546. Change the state of the entry given by \fIindex\fR to \fBdisabled\fR
  547. and redisplay the entry using its disabled colors.
  548. Returns an empty string.
  549. This command is obsolete and will eventually be removed;
  550. use ``\fIpathName \fBentryconfigure \fIindex\fR \-state disabled\fR'' instead.
  551. .VE
  552. .TP
  553. \fIpathName \fBenable \fIindex\fR
  554. .VS
  555. Change the state of the entry given by \fIindex\fR to \fBnormal\fR
  556. and redisplay the entry using its normal colors.
  557. Returns an empty string.
  558. This command is obsolete and will eventually be removed;
  559. use ``\fIpathName \fBentryconfigure \fIindex\fR \-state normal\fR'' instead.
  560. .VE
  561. .TP
  562. \fIpathName \fBentryconfigure \fIindex\fR \fR?\fIoptions\fR?
  563. This command is similar to the \fBconfigure\fR command, except that
  564. it applies to the options for an individual entry, whereas \fBconfigure\fR
  565. applies to the options for the menu as a whole.
  566. \fIOptions\fR may have any of the values accepted by the \fBadd\fR
  567. widget command.  If \fIoptions\fR are specified, options are modified
  568. as indicated
  569. in the command and the command returns an empty string.
  570. If no \fIoptions\fR are specified, returns a list describing
  571. the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for
  572. information on the format of this list).
  573. .TP
  574. \fIpathName \fBindex \fIindex\fR
  575. Returns the numerical index corresponding to \fIindex\fR, or
  576. \fBnone\fR if \fIindex\fR was specified as \fBnone\fR.
  577. .TP
  578. \fIpathName \fBinvoke \fIindex\fR
  579. Invoke the action of the menu entry.  See the sections on the
  580. individual entries above for details on what happens.  If the
  581. menu entry is disabled then nothing happens.  If the
  582. entry has a command associated with it then the result of that
  583. command is returned as the result of the \fBinvoke\fR widget
  584. command.  Otherwise the result is an empty string.  Note:  invoking
  585. a menu entry does not automatically unpost the menu.  Normally
  586. the associated menubutton will take care of unposting the menu.
  587. .TP
  588. \fIpathName \fBpost \fIx y \fR?\fIgroup\fR?
  589. Arrange for the menu to be displayed on the screen at the root-window
  590. coordinates given by \fIx\fR and \fIy\fR.  These coordinates are
  591. adjust if necessary to guarantee that the entire menu is visible on
  592. the screen.  \fIGroup\fR specifies the name of a group to use for
  593. event-sharing purposes, and defaults to \fBdefault\fR.  If the menu
  594. is posted from a menubutton widget then the group must be the same as
  595. the group of the menubutton.  If the menu is posted from a cascade
  596. entry in some other menu, then the group must be the same as the
  597. group of the higher-level menu.  If the menu is posted as a pop-up
  598. menu then the group can probably be defaulted.  To find out more about
  599. groups and event sharing, see the manual entries for \fBmenubutton\fR
  600. and \fBTk_ShareEvents\fR.  This command returns an empty string.
  601. .TP
  602. \fIpathName \fBunpost\fR
  603. Unmap the window so that it is no longer displayed, and remove it
  604. from any event-sharing group it may have been part of.  If a
  605. lower-level cascaded menu is posted, unpost that menu.  Returns an
  606. empty string.
  607.  
  608.  
  609. .SH "DEFAULT BINDINGS"
  610. .PP
  611. .VS
  612. Tk automatically creates class bindings for menus that give them
  613. the following default behavior:
  614. .IP [1]
  615. When the mouse cursor enters a menu, the entry underneath the mouse
  616. cursor is activated;  as the mouse moves around the menu, the active
  617. entry changes to track the mouse.
  618. .IP [2]
  619. When button 1 is released over a menu, the active entry (if any) is invoked.
  620. .IP [3]
  621. A menu can be repositioned on the screen by dragging it with mouse
  622. button 2.
  623. .IP [4]
  624. A number of other bindings are created to support keyboard menu traversal.
  625. See the manual entry for \fBtk_menus\fR for details on these
  626. bindings.
  627. .PP
  628. Disabled menu entries are non-responsive:  they don't activate and
  629. ignore mouse button presses and releases.
  630. .PP
  631. The behavior of menus can be changed by defining new bindings for
  632. individual widgets or by redefining the class bindings.
  633. .VE
  634.  
  635. .SH BUGS
  636. .PP
  637. At present it isn't possible to assign colors and fonts separately
  638. to individual entries.  In addition it isn't possible to use the
  639. option database to specify values for the options to individual
  640. entries.
  641.  
  642. .SH KEYWORDS
  643. menu, widget
  644.